﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace _12306helper.Common.Net
{
    public class HtmlUtil
    {
        public static string GetContent(string content,string beginStr, string endStr)
        {
            if (string.IsNullOrEmpty(content)) return "";
            StringBuilder s = new StringBuilder();
            s.Append(beginStr);
            s.Append(@".*");
            s.Append(endStr);
            Regex reg = new Regex(s.ToString());
            Match match=reg.Match(content);
            if (match.Success)
            {
                return content.Substring(match.Index+beginStr.Length, match.Length-beginStr.Length-endStr.Length);
            }
            else
            {
                return "";
            }
        }
    }
}
